#include <QObject>
#include <QCoreApplication>
#include <QDebug>
#include <QtNetwork/QHttpRequestHeader>
#include <QtNetwork/QHttp>

#include "process.h"

void Process::done(bool error){
	qDebug()<<error;
	QByteArray ba=http->readAll();
	QString str(ba);
	qDebug()<<ba.count();
	qDebug()<<str;
}

int main(int argc,char* argv[]){
	QCoreApplication app(argc,argv);
	
	qDebug()<<"note this";
	
	QHttp http;
	Process p(&http);
	QObject::connect(&http,SIGNAL(done(bool)),
		&p,SLOT(done(bool)));
	
	/*QHttpRequestHeader header("POST", "/search.html");
	header.setValue("Host", "www.trolltech.com");
	header.setContentType("application/x-www-form-urlencoded");
	*/
	QHttpRequestHeader header("Get", "/");
	QString www("www.xuecs.com");
	header.setValue("Host", www);
	
	http.setHost(www);
	http.request(header, "");
	
	return app.exec();
}